#coding=utf-8

from elixir import *

class TradeDay(Entity):
    using_options(tablename='tradedays')
    
    fins = ManyToOne('FInstrument')
    
    date = Field(Date, required=True)
    
    next = OneToOne('TradeDay')
    pre = ManyToOne('TradeDay')

    price = OneToOne('Price')
    
class Price(Entity):
    using_options(tablename='prices')
    
    open = Field(Float)
    close = Field(Float)
    highest = Field(Float)
    lowest = Field(Float)
    
    change = Field(Float)
    jump = Field(Float)
    fluctuation = Field(Float)
    
    volume = Field(Integer)
    amount = Field(Integer)
    trade_rate = Field(Float)
    
    td = ManyToOne('TradeDay')
